<?php
include("DB.php");

function db_connect()
{
	/*
	$result = new mysqli('localhost', 'kalbac', 'kalbac', 'kalbac_db');
	if (!$result)
		throw new Exception('Could not connect to database server');
	else
		return $result;
	*/
	
	//Connection to mysql db using PEAR DB (uri="mysql://user:password@host/db_name"
	$dbh = DB::connect("mysql://kalbac:kalbac@localhost/kalbac_db");
	if (DB::isError($dbh))
	{
		echo 'db_connect() error: '.$dbh->getMessage();
		throw new Exception($dbh->getMessage());
	}
	else
		return $dbh;

}
?>